#region MIT Licence
/*
 * Copyright (C) 2014 PdfCreative
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 
 * and associated documentation files (the "Software"), to deal in the Software without restriction, 
 * including without limitation the rights to use, copy, modify, merge, publish, distribute, 
 * sublicense, and/or sell copies of the Software, and to permit persons to whom 
 * the Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included 
 * in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 
 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE 
 * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
#endregion

using System;
using System.Collections.Generic;
using System.Text;

namespace PdfCreative.Pdf.Graphics
{
    /// <summary>
    /// The InlineText class represents a chunk of styled text. It is the basic unit of styled text as used by the
    /// Graphics class and its DrawStyledText() method. Styled text is composed of one or more InlineText instances
    /// that encapsulate the text, font and colour used.
    /// </summary>
    public class InlineText
    {
        // private fields
        // ==============
        #region private fields
        private Brush _brush;
        private Font _font;
        private float _fontSize;
        private string _text;
        #endregion



        // Public properties
        // =================
        #region Public properties
        /// <summary>
        /// Sets or retrieves the brush used to paint the text.
        /// </summary>
        public Brush Brush
        {
            get { return _brush; }
            set 
            {
                if (null == value) throw new ArgumentNullException("value", "Brush can't be null");
                _brush = value; 
            }
        }

        /// <summary>
        /// Sets or retrieves the font used to paint the text.
        /// </summary>
        public Font Font
        {
            get { return _font; }
            set {
                if (null == value) throw new ArgumentNullException("value", "Font can't be null");
                _font = value; 
            }
        }

        /// <summary>
        /// Sets or retrieves the font size, in points.
        /// </summary>
        public float FontSize
        {
            get { return _fontSize; }
            set { _fontSize = value; }
        }

        /// <summary>
        /// Sets or retrieves the text to render.
        /// </summary>
        public string Text
        {
            get { return _text; }
            set {
                if (null == value) throw new ArgumentNullException("value", "Text can't be null");
                _text = value; }
        }
        #endregion



        // Public constructors
        // ===================
        #region Public constructors
        /// <summary>
        /// Constructs a new InlineText instance.
        /// Note that the font size is expressed in points, regardless of the page unit of the Graphics
        /// instance that the text will be drawn on.
        /// </summary>
        /// <param name="text">The text to draw.</param>
        /// <param name="brush">The brush used to draw the text in.</param>
        /// <param name="font">The font to draw the text in.</param>
        /// <param name="fontSize">The size of the font, in points.</param>
        public InlineText(string text, Brush brush, Font font, float fontSize)
        {
            _text = text;
            _brush = brush;
            _font = font;
            _fontSize = fontSize;
        }
        #endregion

    } // InlineText class
}
